package org.esky;

/**
 * 写一个类实现针对一个分期付款，总期为1年，给定分期金额，期数和开始还款时间，计算出各期还款日期
 */
import java.util.Calendar;
import java.util.Date;

public class T7 {
	@SuppressWarnings("static-access")
	public static void main(String[] args) {
		T7 t = new T7();
		t.huankuan(5, new Date());
	}

	@SuppressWarnings("deprecation")
	public static void huankuan(int num, Date startDate) {
		int period = 365 / num;
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, startDate.getYear() + 1900);
		cal.set(Calendar.MONTH, startDate.getMonth());
		cal.set(Calendar.DATE, startDate.getDate());

		for (int i = 1; i <= num; i++) {
			System.out.println(" 第" + i + "期还款日期: " + cal.getTime().toLocaleString());
			cal.add(Calendar.DATE, period);
		}
	}

}
